﻿/********************************************************************
	日期:2022/5/4 12:29
	名称:MainCityWnd
	邮箱:yunnibbd@163.com
	作者:yunni
	描述:UI事件监听插件
*********************************************************************/

using System;
using UnityEngine;
using UnityEngine.EventSystems;

public class PEListener : MonoBehaviour, IPointerClickHandler, IPointerDownHandler, IPointerUpHandler, IDragHandler{
	public Action<PointerEventData> onClickDown;
	public Action<PointerEventData> onClickUp;
	public Action<PointerEventData> onDraw;
	public Action<object> onClick;

	public object args;

	public void OnPointerDown(PointerEventData eventData){
		if (onClickDown != null){
			onClickDown(eventData);
		}		
	}

	public void OnPointerUp(PointerEventData eventData){
		if (onClickUp != null){
			onClickUp(eventData);
		}
	}

	public void OnDrag(PointerEventData eventData){
		if (onDraw != null){
			onDraw(eventData);
		}
	}

	public void OnPointerClick(PointerEventData eventData){
		if (onClick != null){
			onClick(args);
		}
	}
}
